package cz.muni.fi.stripesdemo.controller;

import cz.muni.fi.stripesdemo.model.Manager;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.validation.Validate;

/**
 *
 */
public class FormActionBean extends BaseActionBean {
    
    @Validate(required=true)
    private int number;
    private String text;       
    
    @DefaultHandler
    public Resolution processForm() {
        
        // do some business operations or call model methods here, like data saving        

        return new ForwardResolution("/result.jsp");
    }
    
    public boolean getIsEven() {
        return (new Manager()).isEven(this.number);
    }
            
    
    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
    
}
